package com.ebelter.seneo.ui.activitys.sets;

import android.app.Dialog;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ebelter.btcomlib.utils.StringUtils;
import com.ebelter.btcomlib.utils.ToastUtil;
import com.ebelter.btcomlib.utils.UserSpUtil;
import com.ebelter.btcomlib.utils.ViewUtils;
import com.ebelter.seneo.R;
import com.ebelter.seneo.contants.IUserContant;
import com.ebelter.seneo.ui.activitys.SeneoBaseActivity;
import com.ebelter.seneo.ui.activitys.SeneoMainActivity;
import com.ebelter.seneo.ui.fragments.main.Set_Fragment;
import com.ebelter.seneo.ui.views.SeneoTipDialog2;
import com.ebelter.seneo.utils.SeneoUtils;

public class DeviceManagerActivity extends SeneoBaseActivity implements View.OnClickListener {




    ImageView top_iv;
    TextView top_tv1;
    TextView devicemanager_tv;


    @Override
    protected int loadLayoutById() {
        return R.layout.activity_divicemanager_ly;
    }

    @Override
    protected void initView() {
        FV();

        setlistener();
    }

    private void setlistener() {

        top_iv.setOnClickListener(this);

    }


    private void FV() {
        top_iv=findViewById(R.id.top_iv);
        top_tv1=findViewById(R.id.top_tv1);
        devicemanager_tv=findViewById(R.id.devicemanager_tv);

        top_tv1.setText("Device management");
        ViewUtils.displayView(top_tv1);

        //devicemanager_tv.setText(SeneoUtils.getBondName()+"\n"+SeneoUtils.getBondAddress());
        devicemanager_tv.setText("Seneo Scale"+"\n"+SeneoUtils.getBondAddress());

    }



    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.top_iv:
                finish();
             break;

        }
    }


    public void unpair(View view) {

        SeneoTipDialog2 seneoTipDialog2=new SeneoTipDialog2(this, StringUtils.getResStr(R.string.device_management_remove_tip));
        seneoTipDialog2.setListener(new SeneoTipDialog2.ICancelOkBtListener() {
            @Override
            public void cancel(Dialog dialogView) {
                dialogView.cancel();
            }

            @Override
            public void ok(Dialog dialogView, String str) {
                UserSpUtil.writeString(IUserContant.IUser.bondAddress,null);
                UserSpUtil.writeString(IUserContant.IUser.bondName,null);
                SeneoUtils.sendCommonEventBus("DeviceManagerActivity", SeneoMainActivity.TAG,IUserContant.ICMDS.UNBOND_DEVICE_SUCCESS,"解绑设备成功");
                dialogView.cancel();
                finish();
            }
        });
        seneoTipDialog2.show();
    }
}
